<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use App\Models\CustomerHealth;
use App\Models\XXlBaseForm;
use Carbon\Carbon;
use Dcat\Admin\Controllers\Dashboard;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;

class HomeController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->title('导航')
            ->description('数据预览')
            ->row(function (Row $row) {
                $row->column(4, function (Column $column) {

                    $today = Carbon::today();
                    $counter = XXlBaseForm::query()
                        ->whereDate('created_at', $today)
                        ->count();

                    $data = [
                        "name" => '今日种植牙表单',
                        "count" => $counter,
                        "url" => "/admin/tt_test-forms?__group_id__=2",
                        "icon" => "fa-copy",
                    ];

                    $column->append(view('adminViews.card-box', [
                        'data' => $data
                    ]));
                });
            });
    }
}
